package site.wanjiahao.service.impl;

import site.wanjiahao.service.UserService;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class UserServiceMemoryImpl implements UserService {

    private static final Map<String, String> map = new ConcurrentHashMap<>();

    static {
        map.put("zhangsan", "zhangsan");
        map.put("lisi", "lisi");
        map.put("wanwu", "wanwu");
        map.put("zhaoliu", "zhaoliu");
    }

    @Override
    public boolean login(String username, String password) {
        String pwd = map.get(username);
        return pwd != null && pwd.equals(password);
    }
}
